<?php

namespace Controllers;

use Models\Project_Model;
use Classes\BaseController;
use Lib\Forms\Form;

class Project_Controller extends BaseController
{

    public function index()
    {

    }

    public function DeleteProject()
    {
        if(isset($_POST['Confirmation']))
        {
            if($_POST['Confirmation'] == 'Confirm')
            {
                $projectModel = new Project_Model;
                $projectModel->Delete($_POST['id']);
                $this->template = "ProjectDeleted";
                $this->DisplayView();
            }
            elseif($_POST['Confirmation'] == 'Cancel')
            {
                $this->http->RedirectInternal("projects/");
            }
        }
        else
        {
            $form = new Form();
            $form->FormOpen();
            $form->AddButton("TestButton","TestButtonValue","TestButtonText");
            $form->FormClose();
            $this->AssignTemplateData("form",$form->GetHtml());
            $this->AssignTemplateData(array('id'=>$this->GetId()));
            $this->DisplayView();
        }

    }

    public function EditProject()
    {
        $this->DisplayView();
    }

    public function ViewProject()
    {
        $this->AssignTemplateData("name","Steve");
        $this->DisplayView();
    }
}
